<template>
	<div class="zgyh-box">
		<!--中国银行特色频道banner-->
		<div class="home-banner" v-if="banner.length>0">
			<swiper :options="swiperOption" class="sw">
				<swiper-slide v-for="(v,index) in banner" :key="index">
					<!--<a :href="v.type === 1 ? v.imagUrl : v.link">-->
					<img v-lazy="v.url" @click="clickBannerImg(v.link,v.dotBanner)" />
					<!-- </a>-->
				</swiper-slide>
				<div v-if="banner.length>1" class="swiper-pagination" slot="pagination"></div>
			</swiper>
		</div>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				banner:[
//				{
//					'url':'https://reboluxiang1.oss-cn-shanghai.aliyuncs.com/saas/banner-ts.png',
//					'link':'https://weixin.txbapp.com/app/operatorzh/home?act=bochina&v=op001',
//					'dotBanner':'featureBanner_1'
//				},
				{
					'url':'https://reboluxiang1.oss-cn-shanghai.aliyuncs.com/saas/banner-ts2.jpg',
					'link':'https://minsight.speiyou.com/page/activity/welfare/home?noauth=1&logo=zgyh',
					'dotBanner':'featureBanner_2'
				}],
				swiperOption: {
					autoplay: {
						delay: 5000,
						stopOnLastSlide: false,
						disableOnInteraction: false,
					},
					pagination: {
						el: '.swiper-pagination',
					},
				}
			}
		},
		methods:{
			clickBannerImg(link,dotId){
				this.dotNum(link,dotId)
			},
			dotNum(link,dotId) { //统计
				let _this = this;
				var argumentData = {
					sessionId: dotId, //场次id
					streamType: 12, //视频类型：1-预告 2-直播 3-回看 10-全局统计 11-商品点击 12-页面
					actionValue: 1, //行为：1-进入 2-离开 3-点击播放 4-留言 5-点赞 6-关注 7-分享 8-开播 9-关播 10-最高峰值
					playSource: fun.getPlatform(), //微信 app
					url: window.location.href, //当前的url
				};
				_this.$http.post("/h5live/recordData", argumentData, {
						headers: {
							"Content-Type": "application/json"
						}
					})
					.then(
						res => {
							if(res.data.code==="000000"){//打点成功 跳转页面
								window.location.href  = link
							}
							
						},
						err => {
							console.log(err);
						}
					);
			},
		}
		
	}
</script>

<style scoped="scoped">
		.home-banner {
		position: relative;
	}
	
	.home-banner a {
		width: 100%;
		display: inline-block;
	}
	
	.home-banner img {
		width: 100%;
		height: 236px;
	}
	
	.sw {
		height: 236px;
	}
</style>